<!doctype html>
<html>
<head>
    <script src="/js/microphone/microphone.js"></script>
</head>
<body>
<script>
    var mic = new Microphone(function(){//this function is called when user allow us to access microphone.
        
        //sample handler
        mic.onSamplesAvailable = function(data,channelCount){
            console.log(data);
        };
        
        //set sample rate
        mic.sampleRate = 44100;

        //get list of microphones available
        console.log(mic.getMicrophoneList());

        //get sample rate
        console.log(mic.sampleRate);

        //get microphone name in use
        console.log(mic.name);
        
        //starts streaming
        mic.start();
        
        //stops streaming after 1 second
        setTimeout(function(){
            mic.stop();
        },2000);
    });
</script>
</body>
</html>
